<?php

/**
 * This is the model class for table "d_ptt".
 *
 * The followings are the available columns in table 'd_ptt':
 * @property integer $ID
 * @property string $KDSATKER
 * @property string $NIP
 * @property string $NAMA
 * @property string $TGLAHIR
 * @property string $SEX
 * @property integer $ISTRI
 * @property integer $ANAK
 * @property string $M511411
 * @property string $M511413
 * @property string $M511414
 */
class DPtt extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return DPtt the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'd_ptt';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ISTRI, ANAK', 'numerical', 'integerOnly'=>true),
			array('KDSATKER', 'length', 'max'=>6),
			array('NIP', 'length', 'max'=>9),
			array('NAMA', 'length', 'max'=>50),
			array('SEX', 'length', 'max'=>1),
			array('M511411, M511413, M511414', 'length', 'max'=>19),
			array('TGLAHIR', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID, KDSATKER, NIP, NAMA, TGLAHIR, SEX, ISTRI, ANAK, M511411, M511413, M511414', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID' => 'ID',
			'KDSATKER' => 'Kdsatker',
			'NIP' => 'Nip',
			'NAMA' => 'Nama',
			'TGLAHIR' => 'Tglahir',
			'SEX' => 'Sex',
			'ISTRI' => 'Istri',
			'ANAK' => 'Anak',
			'M511411' => 'M511411',
			'M511413' => 'M511413',
			'M511414' => 'M511414',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID',$this->ID);
		$criteria->compare('KDSATKER',$this->KDSATKER,true);
		$criteria->compare('NIP',$this->NIP,true);
		$criteria->compare('NAMA',$this->NAMA,true);
		$criteria->compare('TGLAHIR',$this->TGLAHIR,true);
		$criteria->compare('SEX',$this->SEX,true);
		$criteria->compare('ISTRI',$this->ISTRI);
		$criteria->compare('ANAK',$this->ANAK);
		$criteria->compare('M511411',$this->M511411,true);
		$criteria->compare('M511413',$this->M511413,true);
		$criteria->compare('M511414',$this->M511414,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}